package k1_baseGrammar;

public class Demo2_array {

    public static void main(String[] args) {

        //1.1 定义-静态初始化
        int[] nums = {1,2,3,4,5,6,7,8,9,10};
        double doubleNums[] = {1.1,2.2,3.3};

        //1.2 定义-动态初始化
        boolean[] boos = new boolean[3];

        //2.赋值
        boos[1] = true;

        //遍历数组
//        for (int i = 0; i < boos.length; i++) {
//            System.out.println(boos[i]);
//        }

        //增强型for循环 只适用于容器的形式
        //适用于与索引无关的情况下使用
        for(boolean b:boos){
            System.out.println(b);
        }


        int n = 100;
        int[] evenNumber = new int[n/2];

        int index = 0;

        for (int i = 1; i <=100 ; i++) {
            if(i%2==0){
                evenNumber[index++] = i;
            }
        }


//        for (int i : evenNumber) {
//            System.out.println(i);
//        }

        int[] nums1 = {6,39,8,10,2};
        int maxNum = 0;
        for (int i : nums1) {
            if(i>maxNum){
                maxNum = i;
            }
        }

//        System.out.println(maxNum);

        System.out.println(nums1[5]);

    }


}
